package com.highspeed.bdk.bean.entity.logic;

import com.bianmaba.spring.data.jpa.domain.annotations.QueryCacheable;
import com.highspeed.bdk.bean.base.BaseEntity;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Entity
@DynamicUpdate(true)
@DynamicInsert(true)
@QueryCacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class LogicTopology extends BaseEntity {
    @Column(nullable = false, length = 32)
    private String no;

    @Column(nullable = false, length = 16)
    private String name;

    @Column(length = 32)
    private String modifier;

    @Column()
    private Date lastModifyTime;

    @Column(length = 255)
    private String remark;


    @Column(nullable = false)
    private Boolean enabled = true;

    @OneToMany(mappedBy = "logicTopology")
    private List<App> apps = new ArrayList<App>(0);

    @OneToMany(mappedBy = "preinstalledRedLogicTopology")
    private List<App> preinstalledApps = new ArrayList<App>(0);

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getModifier() {
        return modifier;
    }

    public void setModifier(String modifier) {
        this.modifier = modifier;
    }

    public Date getLastModifyTime() {
        return lastModifyTime;
    }

    public void setLastModifyTime(Date lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public List<App> getApps() {
        return apps;
    }

    public void setApps(List<App> apps) {
        this.apps = apps;
    }

    public List<App> getPreinstalledApps() {
        return preinstalledApps;
    }

    public void setPreinstalledApps(List<App> preinstalledApps) {
        this.preinstalledApps = preinstalledApps;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }
}
